package test;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class Log4jtest {
	private static Logger log= Logger.getLogger("default");
	
	public static void main(String[] args) {
		//PropertyConfigurator.configure("c:\\log4j.properties");
		 Properties props = new Properties();
		 try {
			InputStream in = new BufferedInputStream (new FileInputStream("c:\\log4j.properties"));
			try {
				props.load(in);
				props.setProperty("log4j.appender.FILE.File", "logggg.log");
				PropertyConfigurator.configure(props);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		 
		 log.debug("Debug info.");
	     log.info("Info info");
	     log.warn("Warn info");
	     log.error("Error info");
	     log.fatal("Fatal info");
	     
	}

}
